-- p. 69 #4, #5
palindrome, palindrome2 :: [x] -> [x]

palindrome xs = xs ++ (reverse xs)

palindrome2 []     = []
palindrome2 (x:xs) = [x] ++ (palindrome2 xs) ++ [x]


isPalindrome, isPalindrome2 :: (Eq x) => [x] -> Bool

isPalindrome xs = xs == (reverse xs)

isPalindrome2 xs = final
    where (final,_) = check xs
          check [] = (True, xs)
          check (x:xs) = (sofar && (x == head), tail)
                         where (sofar, (head:tail)) = check xs
